import type { IColor } from '@/views/board/core-canvas/types/IStage';
import axios from 'axios';

type barcode = {
  bgcolor: string;
  showText: string;
  text: string;
  textColor: string;
  w: string | number;
  h: string | number;
  margin: string | number;
  rotate: '0' | '90' | '180';
};
type qrcode = {
  text: string;
  /* 二维码的大小 */
  size: number;
  bgcolor: IColor;
  textColor: IColor;
  margin: number;
};

type dithered = {
  str: string;
  color: string;
  width: number;
  height: number;
};

export function previewQrCode(data: qrcode) {
  return axios.post('/template/template/previewQrCode', data);
}

/* 预览条形码 */
export const previewBarCode = (data: barcode) => {
  return axios.post('/template/template/previewBarCode', data);
};

export const dithered = (data: dithered) => {
  return axios.post('/v2/sys/api/floyd', data);
};
